from flask import Flask,current_app,request,Request

app = Flask(__name__)
# ctx = app.app_context()
# ctx.push()
# a = current_app
# d = current_app.config['DEBUG']
# ctx.pop()

# 实现了上下文协议的对象使用with语句
# 上下文管理器
# __enter__(), __exit__()
# 上下文表达式必须要返回一个上下文管理器

with app.app_context():
    a = current_app
    d = current_app.config['DEBUG']